package com.sushengren.easyword.converters;

import com.sushengren.easyword.model.WriteData;

/**
 * 字符串类型转换
 *
 * @author sushengren
 */
public class StringConverter implements Converter {

    @Override
    public WriteData convertToWriteData(String key, Object obj) {
        if (obj == null) {
            return new WriteData(key, "");
        }
        if (obj instanceof String) {
            return new WriteData(key, (String) obj);
        }
        return new WriteData(key, String.valueOf(obj));
    }

}
